package com.songtech.base.listener;

import java.util.HashMap;
import java.util.Map;

import javax.servlet.http.HttpSession;

/**
 * 自定义
 * 根据sessionId
 * 获取session内容
 */
public class SysSessionContext {

	private static Map<String,Object> sessionMap = new HashMap<String,Object>();

    public static synchronized void addSession(HttpSession session) {
        if (session != null) {
        	sessionMap.put(session.getId(),session);
        }
    }

    public static synchronized void delSession(HttpSession session) {
        if (session != null) {
        	sessionMap.remove(session.getId());
        }
    }

    public static synchronized HttpSession getSession(String sessionId) {
        if (sessionId == null)
        return null;
        return (HttpSession) sessionMap.get(sessionId);
    }
}
